package treeset;

import java.util.Comparator;
import java.util.Random;
import java.util.TreeSet;

public class treeset1 {
    public static void main(String[] args) {
        TreeSet<Integer> set = new TreeSet<>();

        Random r = new Random();
        while (true) {

            int i = r.nextInt(51);
            set.add(i);
            if (set.size() >=10) {

                break;
            }
        }
        System.out.println(set);

        TreeSet<Integer> set1=new TreeSet<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                int result=o2-o1;
                return result;
            }
        });
        while (true) {

            int i = r.nextInt(51)+50;
            set1.add(i);
            if (set1.size() >=10) {

                break;
            }
        }
        System.out.println(set1);
    }
}
